package com.angel.provider.health.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.angel.core.base.BaseProviderImpl;
import com.angel.core.util.Pager;
import com.angel.dao.health.BuzAssessmentMapper;
import com.angel.health.BuzAssessment;
import com.angel.health.ln.ChartMap;
import com.angel.provider.health.BuzAssessmentProvider;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

/**
 * @author 作者姓名 cheng
 * @version 创建时间：2016年9月28日 下午7:20:40 类说明
 */
@Service
public class BuzAssessmentProviderImpl extends BaseProviderImpl<BuzAssessment> implements BuzAssessmentProvider {

	@Autowired
	private BuzAssessmentMapper baMapper;

	@Override
	public int delAll(String ids) {
		// TODO Auto-generated method stub
		return baMapper.delAll(ids);
	}

	@Override
	public int updateByCustomerId(BuzAssessment ba) {
		// TODO Auto-generated method stub
		return baMapper.updateByCustomerId(ba);
	}

	@Override
	public List<Map<String, Object>> findAssessmentAll(BuzAssessment ba) {
		// TODO Auto-generated method stub
		return baMapper.findAssessmentAll(ba);
	}

	public List<ChartMap> loadChart() {
		// TODO Auto-generated method stub
		return baMapper.loadChart();
	}

	// 分页查询
	@Override
	public Pager findAll(BuzAssessment record, Pager pager) {
		PageHelper.startPage(pager.getCurrentPage(), pager.getPageSize());
		List<Map<String, Object>> list = baMapper.findAllForPage(record);
		PageInfo<Map<String, Object>> pageInfo = new PageInfo<Map<String, Object>>(list);
		pager.setTotal(pageInfo.getTotal());
		pager.setTotalPages(pageInfo.getPages());
		pager.setList(pageInfo.getList());
		return pager;
	}
}
